<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>

    </style>
</head>

<body>
    <div id="app">
        <!-- 不传 会用默认值 -->
        <child></child>
        <!-- 写死一个值 -->
        <child title="分类"></child>
        <!-- 动态绑定-->
        <child :title="myTitle"></child>
    </div>

    <template id="temp">
        <div>
            <h1>标题 -- {{title}}</h1>
        </div>
    </template>
</body>
<script>
    let child = {
        template: '#temp',
        props: { //   props 可以也是一个对象
            title: {
                default: '默认值', //默认值
                type: String //期望类型
            }
        }
    }
    var vm = new Vue({
        el: '#app',
        data: {
            myTitle: '哈哈'
        },
        components: {
            child
        }
    })
</script>

</html>